import React from 'react'
import { Navigate } from 'react-router-dom'
// 导入路由管理工具
import { RouteObject } from 'react-router-dom'
// 一级路由
const DiscoverMusic = React.lazy(() => import('@/views/discoverMusic'))
const Download = React.lazy(() => import('@/views/download'))
const Follow = React.lazy(() => import('@/views/follow'))
const MyMusic = React.lazy(() => import('@/views/myMusic'))

// 发现音乐DiscoverMusic 二级路由
const Recommend = React.lazy(
  () => import('@/views/discoverMusic/c-views/recommend')
)
const AnchorStation = React.lazy(
  () => import('@/views/discoverMusic/c-views/anchorStation')
)
const NewDiscShelves = React.lazy(
  () => import('@/views/discoverMusic/c-views/newDiscShelves')
)
const Ranking = React.lazy(
  () => import('@/views/discoverMusic/c-views/ranking')
)
const Singer = React.lazy(() => import('@/views/discoverMusic/c-views/singer'))
const SongSheet = React.lazy(
  () => import('@/views/discoverMusic/c-views/songSheet')
)
const routes: RouteObject[] = [
  {
    path: '/',
    element: <Navigate to="/discoverMusic" />
  },
  {
    path: '/discoverMusic',
    element: <DiscoverMusic />,
    children: [
      {
        path: '/discoverMusic',
        element: <Navigate to="/discoverMusic/recommend" />
      },
      {
        path: '/discoverMusic/recommend',
        element: <Recommend />
      },
      {
        path: '/discoverMusic/anchorStation',
        element: <AnchorStation />
      },
      {
        path: '/discoverMusic/newDiscShelves',
        element: <NewDiscShelves />
      },
      {
        path: '/discoverMusic/ranking',
        element: <Ranking />
      },
      {
        path: '/discoverMusic/singer',
        element: <Singer />
      },
      {
        path: '/discoverMusic/songSheet',
        element: <SongSheet />
      }
    ]
  },
  {
    path: '/download',
    element: <Download />
  },
  {
    path: '/follow',
    element: <Follow />
  },
  {
    path: '/myMusic',
    element: <MyMusic />
  }
]

export default routes
